package com.xipu.yygh.order.config.properties;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * description: 在初始化Bean时,读取指定配置文件
 * @author: gql
 * @date: 2022/05
 */
@PropertySource("classpath:wxpay.properties")
@Component
public class WxPayProperties implements InitializingBean {

    /**
     * 公众号appid
     */
    @Value("${weixin.pay.appid}")
    private String appid;

    /**
     * 商户号
     */
    @Value("${weixin.pay.partner}")
    private String partner;

    /**
     * 商户Key
     */
    @Value("${weixin.pay.partnerkey}")
    private String partnerkey;

    /**
     * 微信退款证书
     */
    @Value("${weixin.cert}")
    private String cert;

    public static String APPID;
    public static String PARTNER;
    public static String PARTNERKEY;
    public static String CERT;

    @Override
    public void afterPropertiesSet() throws Exception {
        APPID = appid;
        PARTNER = partner;
        PARTNERKEY = partnerkey;
        CERT = cert;
    }
}

